<?php

/**
 * RegistrationForm class.
 * RegistrationForm is the data structure for keeping
 * user registration form data. It is used by the 'registration' action of 'UserController'.
 */
class RegistrationForm extends User {

    public $verifyPassword;
    public $verifyCode;

    public function rules() {
        return array(
            array('username, password, verifyPassword', 'required'),
            array('username', 'length', 'max' => 50, 'min' => 3, 'message' => Yii::t("UserModule.user", "Incorrect username (length between 3 and 20 characters).")),
            array('password', 'length', 'max' => 128, 'min' => 4, 'message' => Yii::t("UserModule.user", "Incorrect password (minimal length 4 symbols).")),
            array('username', 'email', 'message' => Yii::t("UserModule.user", "Incorrect E-mail address.")),
            array('username', 'unique', 'criteria' => array('condition' => 'is_users=:is_users', 'params' => array(':is_users' => 1))),
            array('verifyPassword', 'compare', 'compareAttribute' => 'password', 'message' => Yii::t("UserModule.user", "Confirm Password is incorrect.")),
            array('issubscribe', 'in', 'range' => array(0, 1, -1)),
                /* array('verifyCode', 'captcha', 'allowEmpty'=>!extension_loaded('gd')), */
                /* array('username', 'match', 'pattern' => '/^[A-Za-z0-9\s,]+$/u','message' => Yii::t("UserModule.user", "Incorrect symbol's. (A-z0-9)")), */
        );
    }

   

}
